var role_1 = [
  {
    path: "/study-room",
    name: "StudyRoom",
    component: () => import("@/views/study-room/Index.vue"),
    meta: { title: "自习室", icon: "School", showInSidebar: true },

    children: [
      {
        path: "", // 空路径，默认显示列表
        name: "StudyRoomList",
        component: () => import("@/components/study-room/List.vue"),
      },
      {
        path: "create",
        name: "CreateRoom",
        component: () => import("@/components/study-room/Create.vue"),
      },
      {
        path: ":roomId",
        name: "RoomDetail",
        component: () => import("@/components/study-room/Room.vue"),
        props: true, // 传递路由参数
      },
    ],
  },
  {
    path: "/user",
    name: "UserProfile",
    component: () => import("@/views/user/Index.vue"),
    meta: { title: "个人资料", icon: "User", showInSidebar: false },
    children: [
      {
        path: "study-data",
        name: "StudyData",
        component: () => import("@/components/user/StudyData.vue"),
        meta: { title: "学习数据" },
      },
      {
        path: "study-plan",
        name: "StudyPlan",
        component: () => import("@/components/user/StudyPlan.vue"),
        meta: { title: "学习计划" },
      },
    ],
  },
  {
    path: "/ai",
    name: "AIAssistant", 
    component: () => import("@/views/ai/Index.vue"),
    meta: { title: "AI助手", icon: "Service", showInSidebar: true },
    children: [
      {
        path: "",
        name: "Chat",
        component: () => import("@/components/ai/Chat.vue"),
        meta: { title: "AI分析" },
      },
      {
        path: ":roomId",
        name: "CatWithRoom",
        component: () => import("@/components/ai/Chat.vue"),
        meta: { title: "AI分析" },
      },
      {
        path: "assistant",
        name: "Assistant",
        component: () => import("@/components/ai/Assistant.vue"),
        meta: { title: "AI分析" },
      },
      // {
      //   path: "chat",
      //   name: "chat",
      //   component: () => import("@/components/ai/Chat.vue"),
      //   meta: { title: "AI分析" },
      // },
      // {
      //   path: "chat/:roomId",
      //   name: "chatWithRoom",
      //   component: () => import("@/components/ai/Chat.vue"),
      //   meta: { title: "AI分析" },
      // },
    ],
  },
  {
    path: "/plan",
    name: "Plan",
    component: () => import("@/views/plan/Index.vue"),
    meta: { title: "学习计划", icon: "Collection", showInSidebar: true },
    children: [
      {
        path: "",
        name: "PlanList",
        component: () => import("@/components/plan/StudyPlan.vue"),
        meta: { title: "学习计划" },
      },
    ],
  },
  {
    path: "/file",
    name: "File",
    component: () => import("@/views/minio/index.vue"),
    meta: { title: "ai文件分析", icon: "Folder", showInSidebar: true },
  },
  {
    path: "/excalidraw",
    name: "ExcalidrawPage",
    component: () => import("@/views/Excalidraw/index.vue"),
    meta: { title: "Excalidraw", icon: "Edit", showInSidebar: true },
    children: [
      {
        path: ":token",
        name: "ExcalidrawRoom",
        component: () =>
          import("@/components/Excalidraw/ExcalidrawWrapper.vue"),
        props: true, // 传递路由参数
        meta: { title: "Excalidraw房间" },
      },
    ],
  },
  {
    path: "/recommend",
    name: "FriendsRecommend",
    component: () => import("@/views/social/Recommend.vue"),
    meta: { title: "好友推荐", icon: "Star", showInSidebar: true },
  },
  {
    path: "/friends",
    name: "FriendsManagement",
    component: () => import("@/views/social/Friends.vue"),
    meta: { title: "好友管理", icon: "User", showInSidebar: true },
  },
];
var role_2 = [
  {
    path: "/user",
    name: "UserProfile",
    component: () => import("@/views/user/Index.vue"),
    meta: { title: "个人资料", icon: "User", showInSidebar: false },
    children: [
      {
        path: "study-data",
        name: "StudyData",
        component: () => import("@/components/user/StudyData.vue"),
        meta: { title: "学习数据" },
      },
      {
        path: "study-plan",
        name: "StudyPlan",
        component: () => import("@/components/user/StudyPlan.vue"),
        meta: { title: "学习计划" },
      },
    ],
  },
  {
    path: "/studyRoom-config",
    name: "studyRoom-config",
    component: () => import("@/views/study-room/StudyRoomConfig.vue"),
    meta: {
      title: "自习室设置",
      icon: "Setting",
      showInSidebar: true,
    },
  },
  {
    path: "/menu",
    name: "menu",
    component: () => import("@/components/menu/Menu.vue"),
    meta: { title: "菜单管理", icon: "Menu", showInSidebar: true },
  },
];
//根据用户角色动态生成路由
export function generateRoutesByRole(role) {
  if (role === 1) {
    return role_1;
  } else if (role === 2) {
    return role_2;
  } else {
    return [];
  }
}
